<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ca="http://java.sun.com/jsf/composite/cashSummery"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">
        <h:outputStylesheet library="css" name="printing.css"></h:outputStylesheet>
        
        <h:form id="panelPrint" styleClass="noBorder summeryBorder">

            <p:panel  style="border: none;">
                <f:facet name="header" >
                    <p:outputLabel value="#{sessionController.institution.name}"/> <br/>
                    <p:outputLabel value="Daily Cash Summary Report"/>
                    
                    <p:commandButton id="btnRefresh" value="Refresh" ajax="false"  styleClass="noPrintButton" actionListener="#{cashSummeryController.makeNull}" style="float: right;" />
                    <p:defaultCommand target="btnRefresh"/>
                    
                    <p:commandButton ajax="false" value="Print"  styleClass="noPrintButton" style="float: right;" >
                        <p:printer target="panelPrint" />
                    </p:commandButton>

                    <p:panelGrid columns="4" style="min-width: 100%;border: none;">
                        <h:outputLabel value="From Date"/>
                        <p:calendar id="frmDate" value="#{cashSummeryController.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To Date"/>
                        <p:calendar id="toDate" value="#{cashSummeryController.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                    </p:panelGrid>
                </f:facet>

            </p:panel>

            <p:dataTable id="acm"  value="#{cashSummeryController.dailyCash}" var="d" 
                         paginator="false"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20">
                <f:facet name="header">
                    <h:outputLabel value="OPD Department Wise"/>
                </f:facet>
                <p:columnGroup type="header">
                    <p:row>

                        <p:column headerText="Category Name"/>
                        <p:column headerText="Hospital Fee"/>   
                        <p:column headerText="Professional Fee"/>
                        <p:column headerText="Total Fee"/>

                    </p:row>
                </p:columnGroup>
                <p:subTable id="safrin" value="#{d.categoryWitmItems}" var="s" rendered="#{d.departmentTotal!=0}">                     

                    <p:column >
                        <p:outputLabel value="#{s.category.name}" rendered="#{s.subTotal!=0}" />   
                    </p:column>
                    <p:column style="text-align: right;">
                        <h:outputLabel value="#{s.subHosTotal}" rendered="#{s.subTotal!=0}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column style="text-align: right;">

                        <h:outputLabel value="#{s.subTotal-s.subHosTotal}" rendered="#{s.subTotal!=0}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>                          

                    </p:column>
                    <p:column  style="text-align: right;">
                        <h:outputLabel value="#{s.subTotal}" rendered="#{s.subTotal!=0}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>    
                    <p:columnGroup type="footer">
                        <p:row>
                            <p:column colspan="3">
                                <f:facet name="footer">
                                    <h:outputLabel value="#{d.department.name} Total" />
                                </f:facet>
                            </p:column>
                            <p:column>
                                <f:facet name="footer">
                                    <h:outputLabel value="#{d.departmentTotal}" style="float: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </f:facet>
                            </p:column>
                        </p:row>
                    </p:columnGroup>
                </p:subTable>
                <p:columnGroup type="footer">
                    <p:row>
                        <p:column colspan="3">
                            <f:facet name="footer">
                                <h:outputLabel value="Total OPD Service Collection"/>
                            </f:facet>
                        </p:column>
                        <p:column style="text-align: right;">
                            <f:facet name="footer">
                                <h:outputLabel value="#{cashSummeryController.departmentTotal}" >
                                    <f:convertNumber pattern="#,##0.00"/>
                                </h:outputLabel>
                            </f:facet>
                        </p:column>
                    </p:row>
                </p:columnGroup>

            </p:dataTable>

            <p:spacer height="30"/>

            <p:dataTable id="summms" value="#{cashSummeryController.summerizeTable}" var="d" 
                         paginator="false"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20">
                <p:column>
                    <h:outputLabel value="#{d.string}" />
                </p:column>
                <p:column style="text-align: right;">
                    <h:outputLabel value="#{d.value}" >
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                </p:column>
            </p:dataTable>

            <p:spacer height="30"/>

            <p:dataTable value="#{cashSummeryController.collections}" var="sm" 
                         paginator="false"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20">
                <p:column >
                    <h:outputLabel value="#{sm.string}" ></h:outputLabel>
                </p:column>
                <p:column style="text-align: right;" >
                    <h:outputLabel value="#{sm.value}" >
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                </p:column>
            </p:dataTable>

            <p:spacer height="30"/>

            <p:dataTable value="#{cashSummeryController.summerizeTableAfter}" var="sm" 
                         paginator="false"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20">
                <p:column >
                    <h:outputLabel value="#{sm.string}" ></h:outputLabel>
                </p:column>
                <p:column style="text-align: right;" >
                    <h:outputLabel value="#{-sm.value}" >
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                </p:column>
            </p:dataTable>

            <p:spacer height="30"/>

            <p:dataTable value="#{cashSummeryController.finalSummery}" var="s" 
                         paginator="false"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20">
                <p:column>
                    <h:outputLabel value="#{s.string}"/>
                </p:column>
                <p:column style="text-align: right;">
                    <h:outputLabel value="#{s.value}" rendered="#{s.value!=0}">
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                    <h:outputLabel value="................" rendered="#{s.value==0}"/>
                </p:column>
            </p:dataTable>

            <p:spacer height="30"/>

            <p:dataTable value="#{cashSummeryController.bankingData}" var="b" 
                         paginator="false"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         rowsPerPageTemplate="5,10,15,20">
                <f:facet name="header">
                    <h:outputLabel value="Bank Deposit" />
                </f:facet>
                <p:column >
                    <h:outputLabel value="#{b.string}"/>
                </p:column>
                <p:column style="text-align: right;" >
                    <h:outputLabel value="......................." />
                </p:column>
            </p:dataTable>


        </h:form>
    </ui:define>


</ui:composition>
